]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Skip weather forecast if not valid
authorPhilip Chimento <philip@endlessm.com>
Tue, 19 Nov 2019 21:31:57 +0000 (13:31 -0800)
committerPhilip Chimento <philip@endlessm.com>
Wed, 20 Nov 2019 21:08:22 +0000 (13:08 -0800)
GWeather.Info.get_value_update() may indicate that the forecast is not
valid, or it may return a timestamp of 0 to indicate the information has
never been updated. In both of these cases, skip creating a widget for
it, as the information will not be accurate.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/835

js/ui/dateMenu.js

index 51413c5660812273722ab897eb7046ecec3ee278..17e6d1723efabf33610bae71890a58627494b8ae 100644 (file)
@@ -333,7 +333,9 @@ class WeatherSection extends St.Button {
 
         let col = 0;
         infos.forEach(fc => {
-            let [ok_, timestamp] = fc.get_value_update();
+            const [valid, timestamp] = fc.get_value_update();
+            if (!valid || timestamp === 0)
+                return;  // 0 means 'never updated'
             let timeStr = Util.formatTime(new Date(timestamp * 1000), {
                 timeOnly: true,
                 ampm: false,